package org.fhm.zdte.common.constant.protocol;

import java.util.Objects;

/**
 * Connection status type enumeration.
 *
 * @author 谭波
 * @since 2023/12/25
 */
public enum ConnectStatus {

    NOT_CONNECTED("not connected"),

    CONNECTING("connecting"),

    CONNECT_SUCCESS("connect successful");


    private final String desc;

    ConnectStatus(String desc) {
        this.desc = desc;
    }

    public static boolean isNotConnected(ConnectStatus status) {
        return NOT_CONNECTED.equals(status);
    }

    public static boolean isConnecting(ConnectStatus status) {
        if (Objects.isNull(status)) {
            return true;
        }
        return CONNECTING.desc.equals(status.desc);
    }

    public String getDesc() {
        return desc;
    }
}
